#!/usr/bin/env python
# -*- coding:utf-8 -*-

class foo:
    static_filed = 'nba'
    def __init__(self):
        self.name='mac'
    def show(self):
        pass
    @staticmethod
    def static_mothod(self):
        pass
    @classmethod
    def class_method(self):
        pass
print foo.__dict__.keys()   #==>['__module__', 'show', 'class_method', 'static_filed', '__doc__', 'static_mothod', '__init__']
print hasattr(foo,"static_filed")   #==>True
obj=foo()
print obj.__dict__      #==>{'name': 'mac'}
print hasattr(obj,"name")   #==>True
print hasattr(obj,"show")   #==>True    #不仅找obj，还要找他的类。


#从其他文件
import home
cls=getattr(home,foo)            ==>home.foo
s_name=getattr(cls,"name")        ==>nba
obj=cls()    #实例化
name=getattr(obj,"name")    ==>mac

